//package com.slife.config.mvc;
//import com.alibaba.fastjson.serializer.SerializerFeature;
//
//import com.alibaba.fastjson.support.config.FastJsonConfig;
//import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
//import com.slife.config.sitemesh.WebSiteMeshFilter;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.web.server.ErrorPage;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.converter.HttpMessageConverter;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
//import java.utils.List;
//
///**
// * Created by chen on 2017/7/17.
// * <p>
// * Email 122741482@qq.com
// * <p>
// * Describe:
// */
//
////@Configuration
////@EnableWebMvc
//public class MvcConfiguration extends WebMvcConfigurerAdapter {
//
//    @Value("${attach_path}")
//    private String attachPath;
//
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/attach/**").addResourceLocations("file:"+attachPath);
//    }
//
//
//    /**
//     * 装饰器
//     *
//     * @return 2016年8月27日下午12:37:20
//     */
//    @Bean
//    public FilterRegistrationBean siteMeshFilter() {
//        FilterRegistrationBean fitler = new FilterRegistrationBean();
//        WebSiteMeshFilter siteMeshFilter = new WebSiteMeshFilter();
//        fitler.setFilter(siteMeshFilter);
//        return fitler;
//    }
//
////    @Bean
////    public EmbeddedServletContainerCustomizer containerCustomizer() {
////        return new EmbeddedServletContainerCustomizer() {
////            @Override
////            public void customize(ConfigurableEmbeddedServletContainer container) {
////                container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/400.html"));
////                container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html"));
////                container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"));
////
////            }
////        };
////    }
//
//
//    @Override
//    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
//
//        FastJsonHttpMessageConverter fastJsonConverter = new FastJsonHttpMessageConverter();
//        FastJsonConfig fjc = new FastJsonConfig();
//        //1、序列化重点
//        fjc.setSerializerFeatures(SerializerFeature.BrowserCompatible);
//        fastJsonConverter.setFastJsonConfig(fjc);
//        converters.add(fastJsonConverter);
//    }
//
//}
